<div id="detail-container" class="container">
    <div id="msg-container">
        <h2 class="error-tips"></h2>
    </div>
    <h2><a href="{$question.question_id|format_question_url=$question['title']}">{$question.title|Input::forShow}</a></h2>
    <div class="content">{$question.details|parse_markup=$question['markup_mode']}</div>
    <form  method="POST" action="{:U('Question/addDetails')}">
        <textarea id="details" class="textarea" name="details" rows="5" cols="90"></textarea>
        <p id="counter" class="counter"></p>
        <eq name="captcha" value="1">
        <div class="captcha-container"><label for="verify">{$Think.lang.captcha}:</label><input id="verify" class="input verify" type="text" name="verify" value="" /><img class="captcha" src="{:U('Ajax/captcha')}" title="{$Think.lang.captcha_again}" onclick="reCaptcha(this);" /></div>
        </eq>
        <p><input id="btn-submit" class="button" type="submit" value="{$Think.lang.submit}" /></p>
    </form>
</div>

<load href="__PUBLIC__/Js/jquery.artTxtCount.js" />
<script type="text/javascript">
$(function(){
    $('#details').artTxtCount($('#counter'), 1500);
    $('#btn-submit').click(function(){
        var url = "{:U('Question/addDetails')}";
        var redirect = $(location).attr('href');
        var data = {
            qid: '{$question.question_id}',
            verify: $('#verify').val(),
            details: $('#details').val()
        };
        $.post(url, data, function(json){
            var json = eval('('+json+')');
            if(json.status == 0){
                $('#msg-container>h2').html(json.info);
                return false;
            }else{
                $('#msg-container>h2').attr('class','success-tips').html(json.info);
                $('#btn-submit').attr({disabled:true, class:'alt-button'});
                setTimeout(function(){
                    window.location.href = redirect;
                }, 3000);
            }
        });
        return false;
    });
});
</script>
